package com.example.czy.enums;

import com.example.czy.exception.BaseException;
import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springframework.http.HttpStatus;

/**
 * 自定义异常枚举
 *
 * @author czy
 * @date 2023-12-29 15:07:31
 **/
@AllArgsConstructor
@Getter
public enum ExceptionEnum {
    SUCCESS(HttpStatus.OK.value(), "成功"),
    ERROR(HttpStatus.INTERNAL_SERVER_ERROR.value(), "失败"),


    OTHER(5000, "其他异常"),


    ;


    Integer code;
    String msg;

    public void assertFail() {
        throw new BaseException(code, msg);
    }
}
